package com.notice.viewmodel;

import com.notice.model.CommentModel;
import com.notice.repository.CommentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class CommentViewModel extends BaseViewModel {
    
    @Autowired
    private CommentRepository commentRepository;
    
    public boolean addComment(CommentModel comment) {
        return commentRepository.save(comment);
    }

    public int getSumVote(CommentModel comment) {
        return commentRepository.GetSumVote(comment);
    }
    
    public List<CommentModel> findComments(CommentModel query) {
        return commentRepository.find(query);
    }
    
    public boolean deleteComment(CommentModel comment) {
        return commentRepository.delete(comment);
    }
    
    public boolean updateComment(CommentModel comment) {
        return commentRepository.update(comment);
    }
} 